export default {
state:{
  token:localStorage.getItem('token')||'',
    //用户角色
  role:localStorage.getItem('role')||'',
  userinof:localStorage.getItem('userinof')?JSON.parse(localStorage.getItem('userinof')):''
},
mutations:{
  //用户成功后缓存用户登录信息
  LOIN(state,{token,role,userinof}){
    state.token=token
    state.role=role
    state.userinof=userinof
    //状态持久化
    localStorage.setItem('token',token)
    localStorage.setItem('role',role)
    localStorage.setItem('userinfo',JSON.stringify(userinof))
  },
  LOGINTO(){
    localStorage.removeItem('token')
    localStorage.removeItem('role')
    localStorage.removeItem('userinof')
  }
}
}
